home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / MixedMode.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  7.4 KB  |  248 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        MixedMode.a
  3. ;
  4. ;    Contains:    Mixed Mode Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  21. __MIXEDMODE__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29. kRoutineDescriptorVersion        EQU        7
  30.  
  31. ; MixedModeMagic Magic Cookie/Trap number 
  32. _MixedModeMagic                    EQU        $AAFE
  33.  
  34. ; Calling Conventions 
  35. ; typedef unsigned short     CallingConventionType
  36.  
  37. kPascalStackBased                EQU        0
  38. kCStackBased                    EQU        1
  39. kRegisterBased                    EQU        2
  40. kD0DispatchedPascalStackBased    EQU        8
  41. kD1DispatchedPascalStackBased    EQU        12
  42. kD0DispatchedCStackBased        EQU        9
  43. kStackDispatchedPascalStackBased EQU        14
  44. kThinkCStackBased                EQU        5
  45.  
  46. ; ISA Types 
  47. ; typedef SInt8             ISAType
  48.  
  49. kM68kISA                        EQU        0
  50. kPowerPCISA                        EQU        1
  51.  
  52. ; RTA Types 
  53. ; typedef SInt8             RTAType
  54.  
  55. kOld68kRTA                        EQU        (0 << 4)
  56. kPowerPCRTA                        EQU        (0 << 4)
  57. kCFM68kRTA                        EQU        (1 << 4)
  58.  
  59. kRegisterD0                        EQU        0
  60. kRegisterD1                        EQU        1
  61. kRegisterD2                        EQU        2
  62. kRegisterD3                        EQU        3
  63. kRegisterD4                        EQU        8
  64. kRegisterD5                        EQU        9
  65. kRegisterD6                        EQU        10
  66. kRegisterD7                        EQU        11
  67. kRegisterA0                        EQU        4
  68. kRegisterA1                        EQU        5
  69. kRegisterA2                        EQU        6
  70. kRegisterA3                        EQU        7
  71. kRegisterA4                        EQU        12
  72. kRegisterA5                        EQU        13
  73. kRegisterA6                        EQU        14
  74. ; A7 is the same as the PowerPC SP 
  75. kCCRegisterCBit                    EQU        16
  76. kCCRegisterVBit                    EQU        17
  77. kCCRegisterZBit                    EQU        18
  78. kCCRegisterNBit                    EQU        19
  79. kCCRegisterXBit                    EQU        20
  80.  
  81. ; typedef unsigned short     registerSelectorType
  82. ; SizeCodes we use everywhere 
  83.  
  84. kNoByteCode                        EQU        0
  85. kOneByteCode                    EQU        1
  86. kTwoByteCode                    EQU        2
  87. kFourByteCode                    EQU        3
  88.  
  89. ; Mixed Mode Routine Records 
  90. ; typedef unsigned long     ProcInfoType
  91. ; Routine Flag Bits 
  92. ; typedef unsigned short     RoutineFlagsType
  93.  
  94. kProcDescriptorIsAbsolute        EQU        $00
  95. kProcDescriptorIsRelative        EQU        $01
  96.  
  97. kFragmentIsPrepared                EQU        $00
  98. kFragmentNeedsPreparing            EQU        $02
  99.  
  100. kUseCurrentISA                    EQU        $00
  101. kUseNativeISA                    EQU        $04
  102.  
  103. kPassSelector                    EQU        $0
  104. kDontPassSelector                EQU        $08
  105.  
  106. kRoutineIsNotDispatchedDefaultRoutine EQU        $0
  107. kRoutineIsDispatchedDefaultRoutine EQU        $10
  108.  
  109. RoutineRecord             RECORD    0
  110. procInfo                 ds.l   1        ; offset: $0 (0)        ; calling conventions 
  111. reserved1                 ds.b   1        ; offset: $4 (4)        ; Must be 0 
  112. ISA                         ds.b   1        ; offset: $5 (5)        ; Instruction Set Architecture 
  113. routineFlags             ds.w   1        ; offset: $6 (6)        ; Flags for each routine 
  114. procDescriptor             ds.l   1        ; offset: $8 (8)        ; Where is the thing we’re calling? 
  115. reserved2                 ds.l   1        ; offset: $C (12)        ; Must be 0 
  116. selector                 ds.l   1        ; offset: $10 (16)        ; For dispatched routines, the selector 
  117. sizeof                     EQU *            ; size:   $14 (20)
  118.                         ENDR
  119.  
  120. ; typedef struct RoutineRecord  RoutineRecord
  121. ; typedef RoutineRecord     *RoutineRecordPtr, **RoutineRecordHandle
  122. ; Mixed Mode Routine Descriptors 
  123. ; Definitions of the Routine Descriptor Flag Bits 
  124. ; typedef UInt8             RDFlagsType
  125.  
  126. kSelectorsAreNotIndexable        EQU        $00
  127. kSelectorsAreIndexable            EQU        $01
  128.  
  129. ; Routine Descriptor Structure 
  130. RoutineDescriptor         RECORD    0
  131. goMixedModeTrap             ds.w   1        ; offset: $0 (0)        ; Our A-Trap 
  132. version                     ds.b   1        ; offset: $2 (2)        ; Current Routine Descriptor version 
  133. routineDescriptorFlags     ds.b   1        ; offset: $3 (3)        ; Routine Descriptor Flags 
  134. reserved1                 ds.l   1        ; offset: $4 (4)        ; Unused, must be zero 
  135. reserved2                 ds.b   1        ; offset: $8 (8)        ; Unused, must be zero 
  136. selectorInfo             ds.b   1        ; offset: $9 (9)        ; If a dispatched routine, calling convention, else 0 
  137. routineCount             ds.w   1        ; offset: $A (10)        ; Number of routines in this RD 
  138. routineRecords             ds     RoutineRecord ; offset: $C (12)    ; The individual routines 
  139. sizeof                     EQU *            ; size:   $20 (32)
  140.                         ENDR
  141.  
  142. ; typedef struct RoutineDescriptor  RoutineDescriptor
  143. ; typedef RoutineDescriptor  *RoutineDescriptorPtr, **RoutineDescriptorHandle
  144.  
  145. ; Calling Convention Offsets 
  146. kCallingConventionWidth            EQU        4
  147. kCallingConventionPhase            EQU        0
  148. kCallingConventionMask            EQU        $F
  149. ; Result Offsets 
  150. kResultSizeWidth                EQU        2
  151. kResultSizePhase                EQU        kCallingConventionWidth
  152. kResultSizeMask                    EQU        $30
  153. ; Parameter offsets & widths 
  154. kStackParameterWidth            EQU        2
  155. kStackParameterPhase            EQU        (kCallingConventionWidth + kResultSizeWidth)
  156. kStackParameterMask                EQU        $FFFFFFC0
  157. ; Register Result Location offsets & widths 
  158. kRegisterResultLocationWidth    EQU        5
  159. kRegisterResultLocationPhase    EQU        (kCallingConventionWidth + kResultSizeWidth)
  160. ; Register Parameter offsets & widths 
  161. kRegisterParameterWidth            EQU        5
  162. kRegisterParameterPhase            EQU        (kCallingConventionWidth + kResultSizeWidth + kRegisterResultLocationWidth)
  163. kRegisterParameterMask            EQU        $7FFFF800
  164. kRegisterParameterSizePhase        EQU        0
  165. kRegisterParameterSizeWidth        EQU        2
  166. kRegisterParameterWhichPhase    EQU        kRegisterParameterSizeWidth
  167. kRegisterParameterWhichWidth    EQU        3
  168. ; Dispatched Stack Routine Selector offsets & widths 
  169. kDispatchedSelectorSizeWidth    EQU        2
  170. kDispatchedSelectorSizePhase    EQU        (kCallingConventionWidth + kResultSizeWidth)
  171. ; Dispatched Stack Routine Parameter offsets 
  172. kDispatchedParameterPhase        EQU        (kCallingConventionWidth + kResultSizeWidth + kDispatchedSelectorSizeWidth)
  173. ; Special Case offsets & widths 
  174. kSpecialCaseSelectorWidth        EQU        6
  175. kSpecialCaseSelectorPhase        EQU        kCallingConventionWidth
  176. kSpecialCaseSelectorMask        EQU        $3F0
  177. ; Component Manager Special Case offsets & widths 
  178. kComponentMgrResultSizeWidth    EQU        2
  179. kComponentMgrResultSizePhase    EQU        kCallingConventionWidth + kSpecialCaseSelectorWidth ; 4 + 6 = 10 
  180. kComponentMgrParameterWidth        EQU        2
  181. kComponentMgrParameterPhase        EQU        kComponentMgrResultSizePhase + kComponentMgrResultSizeWidth ; 10 + 2 = 12 
  182.  
  183. kSpecialCase                    EQU        $0000000F
  184.  
  185. ; all of the special cases enumerated.  The selector field is 6 bits wide 
  186. kSpecialCaseHighHook            EQU        0
  187. kSpecialCaseCaretHook            EQU        0                    ; same as kSpecialCaseHighHook 
  188. kSpecialCaseEOLHook                EQU        1
  189. kSpecialCaseWidthHook            EQU        2
  190. kSpecialCaseTextWidthHook        EQU        2                    ; same as kSpecialCaseWidthHook 
  191. kSpecialCaseNWidthHook            EQU        3
  192. kSpecialCaseDrawHook            EQU        4
  193. kSpecialCaseHitTestHook            EQU        5
  194. kSpecialCaseTEFindWord            EQU        6
  195. kSpecialCaseProtocolHandler        EQU        7
  196. kSpecialCaseSocketListener        EQU        8
  197. kSpecialCaseTERecalc            EQU        9
  198. kSpecialCaseTEDoText            EQU        10
  199. kSpecialCaseGNEFilterProc        EQU        11
  200. kSpecialCaseMBarHook            EQU        12
  201. kSpecialCaseComponentMgr        EQU        13
  202.  
  203.     IF GENERATINGCFM  THEN
  204. ;
  205. ; pascal UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
  206. ;
  207.     IF ¬ GENERATINGCFM THEN
  208.         Macro
  209.         _NewRoutineDescriptor
  210.             moveq    #0,d0
  211.             dc.w     $AA59
  212.         EndM
  213.     ELSE
  214.         IMPORT_CFM_FUNCTION    NewRoutineDescriptor
  215.     ENDIF
  216.  
  217. ;
  218. ; pascal void DisposeRoutineDescriptor(UniversalProcPtr theProcPtr)
  219. ;
  220.     IF ¬ GENERATINGCFM THEN
  221.         Macro
  222.         _DisposeRoutineDescriptor
  223.             moveq    #1,d0
  224.             dc.w     $AA59
  225.         EndM
  226.     ELSE
  227.         IMPORT_CFM_FUNCTION    DisposeRoutineDescriptor
  228.     ENDIF
  229.  
  230. ;
  231. ; pascal UniversalProcPtr NewFatRoutineDescriptor(ProcPtr theM68kProc, ProcPtr thePowerPCProc, ProcInfoType theProcInfo)
  232. ;
  233.     IF ¬ GENERATINGCFM THEN
  234.         Macro
  235.         _NewFatRoutineDescriptor
  236.             moveq    #2,d0
  237.             dc.w     $AA59
  238.         EndM
  239.     ELSE
  240.         IMPORT_CFM_FUNCTION    NewFatRoutineDescriptor
  241.     ENDIF
  242.  
  243.     ELSE
  244.     ENDIF
  245.     IF CFMSYSTEMCALLS  THEN
  246.     ENDIF
  247.     ENDIF ; __MIXEDMODE__
  248.